import http from "@/api/axios";

// 批量上传转单号
export const uploadTransferNoApi = (data: WaybillQuotation.SearchParams) => {
  return http({
    method: "post",
    url: "/base/biz/bizPreOrderShipment/uploadTransferNo",
    data
  });
};

// 客服运单管理-设置运单转单号
export const updateWayBillTransferNoApi = (data: WaybillQuotation.SearchParams) => {
  return http({
    method: "post",
    url: "/base/biz/bizPreOrderShipment/updateWayBillTransferNo",
    data
  });
};

// 批量设置运单物流轨迹
export const bachSaveApi = (data: WaybillQuotation.SearchParams) => {
  return http({
    method: "post",
    url: "/base/biz/logistics/bachSave",
    data
  });
};

// 导入物流轨迹
export const importLogisticsApi = (formData: FormData) => {
  return http({
    method: "post",
    url: "/base/biz/logistics/importLogistics",
    data: formData,
    headers: {
      "Content-type": "multipart/form-data"
    }
  });
};

// 操作栏 -回退运单状态
export const fallbackPreOrderShipmentStatusApi = (data: WaybillQuotation.SearchParams) => {
  return http({
    method: "post",
    url: "/base/biz/bizPreOrderShipment/fallbackPreOrderShipmentStatus",
    data
  });
};

//操作栏-出仓
export const outWarehouseApi = (data: CustomerServiceWaybill.StaHandle) => {
  return http({
    method: "post",
    url: "/base/biz/bizPreOrderShipment/outWarehouse",
    data
  });
};

//操作栏-出库
export const foutboundShipmentsApi = (data: CustomerServiceWaybill.StaHandle) => {
  return http({
    method: "post",
    url: "/base/biz/bizPreOrderShipment/outboundShipments",
    data
  });
};

//操作栏-修改出仓代理
export const updateOutWarehouseBrokeApi = (data: Base.GeneraDataType) => {
  return http({
    method: "post",
    url: "/base/biz/bizPreOrderShipment/updateOutWarehouseBroke",
    data
  });
};

//操作栏-出运
export const shippingApi = (data: CustomerServiceWaybill.StaHandle) => {
  return http({
    method: "post",
    url: "/base/biz/bizPreOrderShipment/shipping",
    data
  });
};

//操作栏-签收
export const signingApi = (data: CustomerServiceWaybill.StaHandle) => {
  return http({
    method: "post",
    url: "/base/biz/bizPreOrderShipment/signing",
    data
  });
};

//详情-设置箱子转单号
export const updateTransferNoApi = (data: CustomerServiceWaybill.StaHandle) => {
  return http({
    method: "post",
    url: "/base/biz/bizPreOrderShipment/updateTransferNo",
    data
  });
};
// 统计
export const statisticsDataApi = (data: CustomerServiceWaybill.SearchForm) => {
  return http({
    method: "post",
    url: `/base/biz/bizPreOrderShipment/manager/getPreOrderShipmentEsStatisticsRes`,
    data
  });
};

// 修改物流信息
export const updateLogisticsApi = (data: CustomerServiceWaybill.SearchForm) => {
  return http({
    method: "post",
    url: `/base/biz/logistics/updateLogistics`,
    data
  });
};

// 删除物流信息
export const deleteByTrackInfoIdApi = (params: { id: string }) => {
  return http({
    method: "delete",
    url: `/base/biz/logistics/deleteById`,
    params
  });
};

// 更改代理渠道
export const updatePreOrderShipmentAgentChannelApi = (data: CustomerServiceWaybill.ModifyAgentChannelAddFrom) => {
  return http({
    method: "post",
    url: `/base/biz/bizInWarehouseManage/updatePreOrderShipmentAgentChannel`,
    data
  });
};

// 修改货箱材积明细
export const updateBoxVolumeApi = (data: Base.GeneraDataType) => {
  return http({
    method: "post",
    url: `/base/biz/bizInWarehouseManage/updateBoxVolume`,
    data
  });
};

// 同步材积明细
export const updateBoxVolumePushTtApi = (data: Base.GeneraDataType) => {
  return http({
    method: "post",
    url: `/base/biz/bizInWarehouseManage/updateBoxVolumePushTt`,
    data
  });
};

//修改结算重
export const updateSettlementWeightApi = (data: { id: string; settlementWeight: number }) => {
  return http({
    method: "post",
    url: `/base/biz/bizInWarehouseManage/updateSettlementWeight`,
    data
  });
};

//手动推运单推单到(天图或者其他)
export const pushOrdersTttxApi = (data: { idList: string[]; status: string }) => {
  return http({
    method: "post",
    url: `/base/biz/thirdPartyApi/pushOrdersTttx`,
    data
  });
};

//转至海外仓运单
export const turnShipmentWarehouseApi = (data: Base.GeneraDataType) => {
  return http({
    method: "post",
    url: `/base/biz/bizPreOrderShipment/turnShipmentWarehouse`,
    data
  });
};

//推机器拣货的客户长宽高数据给天图
export const pushCustomerDataApi = (data: Base.GeneraDataType) => {
  return http({
    method: "post",
    url: `/base/biz/preOrderShipmentBox/pushCustomerData`,
    data
  });
};

// 使用模版导出
export const createTemplateFileApi = (data: Base.GeneraDataType) => {
  return http({
    method: "post",
    url: `/export/biz/exportTemplate/customerCreateTemplateFile`,
    data
  });
};

// 自定义模版导出
export const customizeImportApi = (data: Base.GeneraDataType) => {
  return http({
    method: "post",
    url: `/export/biz/exportTemplate/customerCustomizeImport`,
    data
  });
};

// 运单工单-创建工单
export const createWorkOrderApi = (data: Base.GeneraDataType) => {
  return http({
    method: "post",
    url: "/base/biz/orderShipmentWorkOrder/createWorkOrder",
    data
  });
};

// 运单工单-修改目的地
export const updateDestinationApi = (data: Base.GeneraDataType) => {
  return http({
    method: "post",
    url: "/base/biz/bizPreOrderShipment/updateDestination",
    data
  });
};

// 批量导入excel-箱子转单号
export const importBoxTransferNoApi = (formData: FormData) => {
  return http({
    method: "post",
    url: "/base/biz/bizPreOrderShipment/importBoxTransferNo",
    data: formData,
    headers: {
      "Content-type": "multipart/form-data"
    }
  });
};

// 租户管理端-客服-业务运单管理-恢复运单
export const recoverShipmentApi = (data: Array<string>) => {
  return http({
    method: "post",
    url: "/base/biz/bizPreOrderShipment/recoverShipment",
    data
  });
};

// 导出运单材积明细
export const shipmentBoxVolumeExcelListApi = (data: Array<string>) => {
  return http({
    method: "post",
    url: "/export/biz/exportExcel/shipmentBoxVolumeExcelList",
    data,
    responseType: "blob",
    headers: {
      enable: true
    }
  });
};

// 转运
export const isTransferBillApi = (data: { idList: Array<string>; isTransferBill: number }) => {
  return http({
    method: "post",
    url: "/base/biz/bizPreOrderShipment/transport",
    data
  });
};

// 合并报关
export const customsClearanceApi = (data: Array<string>) => {
  return http({
    method: "post",
    url: "/base/biz/bizPreOrderShipment/mergeDeclaration",
    data
  });
};

//运单-取消合并报关
export const cancelMergeDeclarationApi = (data: Array<string>) => {
  return http({
    method: "post",
    url: `/base/biz/bizPreOrderShipment/cancelMergeDeclaration`,
    data
  });
};

//修改客服备注
export const updateCustomerServiceRemarkApi = (data: { idList: Array<string>; customerServiceRemark: string }) => {
  return http({
    method: "post",
    url: `/base/biz/bizPreOrderShipment/updateCustomerServiceRemark`,
    data
  });
};

//客服运单-导出客服运单报价excel
export const passShipmentQuotationExcelkApi = (data: Base.GeneraDataType) => {
  return http({
    method: "post",
    url: `/export/biz/exportExcel/passShipmentQuotationExcel`,
    data
  });
};

//客户端-导出运单
export const customerShipmentExcelApi = (data: Base.GeneraDataType) => {
  return http({
    method: "post",
    url: `/export/biz/exportExcel/customerShipmentExcel`,
    data,
    responseType: "blob",
    headers: {
      enable: true
    }
  });
};

// 客户端-导出运单费用明细
export const customerShipmentCostExcelApi = (data: Base.GeneraDataType) => {
  return http({
    method: "post",
    url: `/export/biz/exportExcel/customerShipmentCostExcel`,
    data
    // responseType: "blob",
    // headers: {
    //   enable: true
    // }
  });
};

// 修改运踪状态
export const updateTrackStatusApi = (data: { idList: Array<string>; trackStatus: number }) => {
  return http({
    method: "post",
    url: `/base/biz/bizPreOrderShipment/updateTrackStatus`,
    data
  });
};

// 修改运踪状态
export const syncTrackApi = (data: { idList: Array<string> }) => {
  return http({
    method: "post",
    url: `/base/biz/bizPreOrderShipment/syncTrack`,
    data
  });
};

//新增问题件
export const addProblemPieceApi = (data: Base.GeneraDataType) => {
  return http({
    method: "post",
    url: `/base/biz/bizProblemPiece/add`,
    data
  });
};

//编辑问题件
export const editProblemPieceApi = (data: Base.GeneraDataType) => {
  return http({
    method: "post",
    url: `/base/biz/bizProblemPiece/edit`,
    data
  });
};
